const http = require("http");
const app = require('./views/router')
// const app = require('./views/router copy')
const ejs = require('ejs')

// 注册 web服务
http.createServer(app).listen(3000);

app.static("public");

// 配置路由
app.get('/',function(req,res){
    res.send('首页')
})

app.get('/login',function(req,res){
    ejs.renderFile('./views/form.ejs',{},(err,data)=>{
        res.send(data)
    })
})
app.post('/doLogin',function(req,res){
    console.log(req.body);
    res.send(req.body)
})

console.log('http://127.0.0.1:3000/');